home *** CD-ROM | disk | FTP | other *** search
/ Champak 132 (Alt) / Vol 132.iso / games / sweettim.swf / scripts / frame_8 / PlaceObject2_215_194 / CLIPACTIONRECORD onClipEvent(load).as < prev   
Encoding:
Text File  |  2011-06-09  |  3.1 KB  |  92 lines

  1. onClipEvent(load){
  2.    function updateRack(numberPress, sweetType)
  3.    {
  4.       _root.jake.gotoAndStop("j_refill");
  5.       _root.sounds.gotoAndPlay("j_refill");
  6.       trace("Sweet Rack: " + _root.rackControl.sweetRack);
  7.       trace("current sweet: " + _root.currentSweet);
  8.       trace("numberPressed: " + numberPress);
  9.       trace("sweetType: " + sweetType);
  10.       trace("Stored sweet type: " + _root.rackControl.sweetRack[numberPress - 1][0]);
  11.       trace("=======================");
  12.       if(_root.rackControl.sweetRack[numberPress - 1][0] == sweetType)
  13.       {
  14.          _root.interfaceControl.updateScoreText(_root.cashFillCorrect);
  15.          _root.rackMoney.gotoAndPlay("rack_correct");
  16.          _root.rackControl.sweetRack[numberPress - 1][1] = 0;
  17.          eval("_root.area_" + numberPress).level.gotoAndStop(1);
  18.          _root.interfaceControl.updateSpeechBubble(10);
  19.       }
  20.       else
  21.       {
  22.          _root.interfaceControl.updateScoreText(_root.cashFillWrong);
  23.          _root.rackMoney.gotoAndPlay("rack_wrong");
  24.          _root.interfaceControl.updateSpeechBubble(10);
  25.       }
  26.       _root.currentSweet = -1;
  27.    }
  28.    function serveTill()
  29.    {
  30.       _root.jake.gotoAndStop("j_action");
  31.       _root.sounds.gotoAndPlay("j_till");
  32.       _root.interfaceControl.updateScoreText(_root.childControl.childBagValue);
  33.       _root.customer.gotoAndPlay("k" + _root.childControl.childType + "_hide");
  34.       switch(_root.childControl.childBagValue)
  35.       {
  36.          case 500:
  37.             _root.tillMoney.gotoAndPlay("type_4");
  38.             break;
  39.          case 375:
  40.             _root.tillMoney.gotoAndPlay("type_3");
  41.             break;
  42.          case 250:
  43.             _root.tillMoney.gotoAndPlay("type_2");
  44.             break;
  45.          case 125:
  46.             _root.tillMoney.gotoAndPlay("type_1");
  47.       }
  48.       _root.childControl.childAtTill = false;
  49.       _root.childControl.childBagValue = 0;
  50.       _root.childControl.childType = 0;
  51.    }
  52.    function dispenseSweet()
  53.    {
  54.       lstAreas = new Array();
  55.       areas = 0;
  56.       while(areas < 9)
  57.       {
  58.          temp = _root.rackControl.sweetRack[areas][1];
  59.          if(temp > 0)
  60.          {
  61.             lstAreas.push({arrayNum:areas,fillValue:temp});
  62.          }
  63.          areas++;
  64.       }
  65.       lstAreas = lstAreas.sortOn("fillValue",Array.NUMERIC);
  66.       lstAreas = lstAreas.reverse();
  67.       if(lstAreas.length < 4)
  68.       {
  69.          rndMax = lstAreas.length;
  70.       }
  71.       else
  72.       {
  73.          rndMax = 4;
  74.       }
  75.       if(lstAreas.length >= 1)
  76.       {
  77.          rndDrop = Math.floor(Math.random() * rndMax);
  78.          _root.currentSweet = _root.rackControl.sweetRack[lstAreas[rndDrop].arrayNum][0];
  79.          _root.jake.gotoAndPlay("j_action");
  80.          _root.sounds.gotoAndPlay("j_dispenser");
  81.          _root.dispenser.gotoAndPlay("sweet_" + _root.rackControl.sweetRack[lstAreas[rndDrop].arrayNum][0]);
  82.          _root.interfaceControl.updateSpeechBubble(_root.rackControl.sweetRack[lstAreas[rndDrop].arrayNum][0]);
  83.       }
  84.    }
  85.    jakeSpeed = 20;
  86.    walking = false;
  87.    action = "";
  88.    actionFilled = false;
  89.    actionServed = false;
  90.    actionCollected = false;
  91. }
  92.